package com.gts.sofa.service;

import com.gts.sofa.dao.BookDao;
import com.gts.sofa.enu.Order;
import com.gts.sofa.enu.Season;
import com.gts.sofa.pojo.Person;
import com.gts.sofa.pojo.Student;
import com.gts.sofa.pojo.Yellow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import java.lang.annotation.Annotation;

@Service
public class MyService {

    //@Qualifier("yellow")
    @Autowired(required = false)
    Yellow yellow2;


    @Autowired(required = false)
    BookDao bookDao;

    public String sayHello(String name){

        System.out.println(yellow2);

        Season season = Season.SPRING;

        System.err.println(season);

        Order nonPayment =  Order.NONPAYMENT;
        System.err.println(Order.class.getSuperclass());

        System.out.println(nonPayment);

        System.out.println("=======================");
        Order[] orders = nonPayment.values();

        for (int i = 0; i < orders.length; i++) {
            System.out.println(orders[i]);

        }

        Order RETURNED = Order.valueOf("RETURNED");

        System.out.println(RETURNED);

        RETURNED.show();

        bookDao.book();


        Class clazz = Student.class;
        Annotation[] annotations = clazz.getAnnotations();

        for (int i = 0; i < annotations.length; i++) {
            System.out.println(annotations[i]);
        }





        return "hello"+name;
    }
}
